Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Collections.​Generic.​LinkedList<​T>
Assembly: System.Collections
Inheritance: object → LinkedList
Implemented Interfaces
- ICollection`1 (Inherits: IEnumerable<​T>IEnumerable)
- IReadOnlyCollection`1 (Inherits: IEnumerable<​T>IEnumerable)
- ICollection (Inherits: IEnumerable)
- Runtime.​Serialization.​IDeserializationCallback
- Runtime.​Serialization.​ISerializable
Represents a doubly linked list.
Properties
public
int
Count
Gets the number of nodes actually contained in the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
LinkedListNode<​T>
First
Gets the first node of the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
LinkedListNode<​T>
Last
Gets the last node of the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
Methods
public
void
AddAfter​(LinkedListNode<​T> node,
LinkedListNode<​T> newNode)
Adds the specified new node after the specified existing node in the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
node
The <see cref="T:System.Collections.Generic.LinkedListNode`1" /> after which to insert <paramref name="newNode" /> .
newNode
The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> to add to the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
LinkedListNode<​T>
AddAfter​(LinkedListNode<​T> node,
T value)
Adds a new node containing the specified value after the specified existing node in the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
Returns The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> containing <paramref name="value" /> .
node
The <see cref="T:System.Collections.Generic.LinkedListNode`1" /> after which to insert a new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> containing <paramref name="value" /> .
value
The value to add to the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
void
AddBefore​(LinkedListNode<​T> node,
LinkedListNode<​T> newNode)
Adds the specified new node before the specified existing node in the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
node
The <see cref="T:System.Collections.Generic.LinkedListNode`1" /> before which to insert <paramref name="newNode" /> .
newNode
The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> to add to the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
LinkedListNode<​T>
AddBefore​(LinkedListNode<​T> node,
T value)
Adds a new node containing the specified value before the specified existing node in the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
Returns The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> containing <paramref name="value" /> .
node
The <see cref="T:System.Collections.Generic.LinkedListNode`1" /> before which to insert a new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> containing <paramref name="value" /> .
value
The value to add to the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
void
AddFirst​(LinkedListNode<​T> node)
Adds the specified new node at the start of the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
node
The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> to add at the start of the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
LinkedListNode<​T>
AddFirst​(T value)
Adds a new node containing the specified value at the start of the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
Returns The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> containing <paramref name="value" /> .
value
The value to add at the start of the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
void
AddLast​(LinkedListNode<​T> node)
Adds the specified new node at the end of the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
node
The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> to add at the end of the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
LinkedListNode<​T>
AddLast​(T value)
Adds a new node containing the specified value at the end of the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
Returns The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> containing <paramref name="value" /> .
value
The value to add at the end of the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
void
Clear​()
Removes all nodes from the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
bool
Contains​(T value)
Determines whether a value is in the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
Returns <see langword="true" /> if <paramref name="value" /> is found in the <see cref="T:System.Collections.Generic.LinkedList`1" /> ; otherwise, <see langword="false" /> .
value
The value to locate in the <see cref="T:System.Collections.Generic.LinkedList`1" /> . The value can be <see langword="null" /> for reference types.
public
void
CopyTo​(T[] array,
int index)
Copies the entire <see cref="T:System.Collections.Generic.LinkedList`1" /> to a compatible one-dimensional <see cref="T:System.Array" /> , starting at the specified index of the target array.
array
The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.Generic.LinkedList`1" /> . The <see cref="T:System.Array" /> must have zero-based indexing.
index
The zero-based index in <paramref name="array" /> at which copying begins.
public
LinkedListNode<​T>
Find​(T value)
Finds the first node that contains the specified value.
Returns The first <see cref="T:System.Collections.Generic.LinkedListNode`1" /> that contains the specified value, if found; otherwise, <see langword="null" /> .
value
The value to locate in the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
LinkedListNode<​T>
FindLast​(T value)
Finds the last node that contains the specified value.
Returns The last <see cref="T:System.Collections.Generic.LinkedListNode`1" /> that contains the specified value, if found; otherwise, <see langword="null" /> .
value
The value to locate in the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
Enumerator<​T>
GetEnumerator​()
Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
Returns An <see cref="T:System.Collections.Generic.LinkedList`1.Enumerator" /> for the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
void
GetObjectData​(Runtime.​Serialization.​SerializationInfo info,
Runtime.​Serialization.​StreamingContext context)
Implements the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface and returns the data needed to serialize the <see cref="T:System.Collections.Generic.LinkedList`1" /> instance.
info
A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object that contains the information required to serialize the <see cref="T:System.Collections.Generic.LinkedList`1" /> instance.
context
A <see cref="T:System.Runtime.Serialization.StreamingContext" /> object that contains the source and destination of the serialized stream associated with the <see cref="T:System.Collections.Generic.LinkedList`1" /> instance.
public
void
OnDeserialization​(object sender)
Implements the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface and raises the deserialization event when the deserialization is complete.
sender
The source of the deserialization event.
public
void
Remove​(LinkedListNode<​T> node)
Removes the specified node from the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
node
The <see cref="T:System.Collections.Generic.LinkedListNode`1" /> to remove from the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
bool
Remove​(T value)
Removes the first occurrence of the specified value from the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
Returns <see langword="true" /> if the element containing <paramref name="value" /> is successfully removed; otherwise, <see langword="false" /> . This method also returns <see langword="false" /> if <paramref name="value" /> was not found in the original <see cref="T:System.Collections.Generic.LinkedList`1" /> .
value
The value to remove from the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
void
RemoveFirst​()
Removes the node at the start of the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
void
RemoveLast​()
Removes the node at the end of the <see cref="T:System.Collections.Generic.LinkedList`1" /> .
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object